<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Drag and Drop Example</title>
<style>
#dropZone {
  width: 300px;
  height: 200px;
  border: 1px solid #000;
  margin-bottom: 10px;
}
 
.draggableItem {
  width: 100px;
  height: 50px;
  background-color: #f00;
  color: #fff;
  text-align: center;
  line-height: 50px;
  border: 1px solid #000;
  margin: 5px;
  cursor: move;
}
</style>
</head>
<body>
 
<div id="dropZone">Drop Here</div>
<div class="draggableItem" draggable="true">Drag Me</div>
 
<script>
const dropZone = document.getElementById('dropZone');
const draggables = document.querySelectorAll('.draggableItem');
 
draggables.forEach(draggable => {
  draggable.addEventListener('dragstart', function(event) {
    event.dataTransfer.setData("text/plain", event.target.innerText);
  });
});
 
dropZone.addEventListener('dragover', function(event) {
  event.preventDefault(); // Prevent default to allow drop
});
 
dropZone.addEventListener('drop', function(event) {
  event.preventDefault();
  const text = event.dataTransfer.getData("text");
  dropZone.innerText += text;
});
</script>
 
</body>
</html>